package com.zhuyuan.repository;


import com.zhuyuan.Entity.Navigation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface NavigationRepository extends JpaRepository<Navigation,Integer> {

    // 或者使用@Query注解
    @Query("SELECT u FROM Navigation u WHERE u.status = 1")
    List<Navigation> findActiveNavigations();

    @Modifying
    @Query("UPDATE Navigation n SET n.status = 0 WHERE n.title = :title and n.url = :url")
    void isdelete(@Param("title") String title,@Param("url") String url);
}

